package com.xposed.aliproxy.xposed.utils;

import android.content.Context;
import android.content.Intent;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.xposed.aliproxy.utils.XposeUtil;

import org.json.JSONArray;
import org.json.JSONObject;
import de.robv.android.xposed.XposedBridge;

public class XMerTradeNoRequestCallBack extends RequestCallBack<String> {
    private Context context;
    private String cookie;

    @Override
    public void onFailure(HttpException httpException, String str) {
    }

    public XMerTradeNoRequestCallBack(Context context, String str) {
        this.context = context;
        this.cookie = str;
    }

    @Override
    public void onSuccess(ResponseInfo<String> responseInfo) {
        try {
            JSONArray jSONArray = new JSONObject((String) responseInfo.result).getJSONObject("result").getJSONArray("list");
            if (jSONArray != null) {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.append(jSONArray.length());
                stringBuilder.append("");
                XposeUtil.xposedLog("jsonArray.length->", stringBuilder.toString());
            }
            if (jSONArray != null && jSONArray.length() > 0) {
                for (int i = 0; i < jSONArray.length(); i++) {
                    JSONObject jSONObject = jSONArray.getJSONObject(i);
                    String string = jSONObject.getString("tradeNo");
                    String string2 = jSONObject.getString("consumerName");
                    XposeUtil.xposedLog("tradeNo->", string);
                    Intent intent = new Intent("com.abcd.xpouseali.action.alitradeno.received");
                    intent.putExtra("tradeNo", string);
                    intent.putExtra("name", string2);
                    intent.putExtra("cookie", this.cookie);
                    this.context.sendBroadcast(intent);
                }
            }
        } catch (Throwable th) {
            XposedBridge.log(th);
        }
    }
}
